import Vue from 'vue'

import demo from './components/demo'
import fetch from './methods/fetch'

const components = [
  demo
]

const install = function (Vue, opts = {}, lang) {
  components.forEach(component => {
    Vue.component(component.name, component)
  })
}

Vue.prototype.$fetch = fetch

if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue)
}

export default {
  version: '1.0.0',
  install: install,
  demo
}
